home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Cappuccino / Source / CappuccinoLinking.cpp < prev    next >
Encoding:
Text File  |  1995-12-11  |  4.8 KB  |  178 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CappuccinoLinking.cpp
  3.     
  4.     Contents:    Stub functions to be implemented for linking support.
  5.     
  6.                 If you wish to add linking support to a part, you must 
  7.                 implement the functions in this file.  If you do not wish 
  8.                 to support this feature, you can save a little space by removing 
  9.                 these functions and the similarly-named functions in the SOM 
  10.                 class.
  11.     
  12.     Written by:    Troy Gaul
  13.     
  14.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  15. */
  16.  
  17. // -- Compiler/Preprocessor Switches --
  18.  
  19. #ifndef _COMPILERDEFS_
  20. #include "CompDefs.h"
  21. #endif
  22.  
  23. // -- OpenDoc Utilities --
  24.  
  25. #ifndef _EXCEPT_
  26. // Exceptions define several important macros (eg. CHECKENV)
  27. // which are used in the SOM method dispatch glue. If Except.h
  28. // is not included early enough, exceptions may not be thrown
  29. // correctly when returning from a SOM method with the "ev" parameter set.
  30. #include <Except.h>
  31. #endif
  32.  
  33. // -- Cappuccino Includes --
  34.  
  35. #ifndef _CAPPUCCINO_
  36. #include "Cappuccino.h"
  37. #endif
  38.  
  39. #ifndef _CAPPUCCINOCONTENT_
  40. #include "CappuccinoContent.h"
  41. #endif
  42.  
  43. #ifndef _CAPPUCCINODEF_
  44. #include "CappuccinoDef.h"
  45. #endif
  46.  
  47. #ifndef _CAPPUCCINOGLOBALS_
  48. #include "CappuccinoGlobals.h"
  49. #endif
  50.  
  51. // -- OpenDoc Includes --
  52.  
  53. #ifndef _ODTYPES_
  54. #include <ODTypes.h>
  55. #endif
  56.  
  57. // -- OpenDoc Utilities --
  58.  
  59. #ifndef _ODUTILS_
  60. #include <ODUtils.h>
  61. #endif
  62.  
  63.  
  64. //------------------------------------------------------------------------------
  65. // Method:        CreateLink
  66. // Origin:        ODPart
  67. //
  68. // Description:    This method is called ...
  69. //------------------------------------------------------------------------------
  70.  
  71. ODLinkSource* Cappuccino::CreateLink( Environment*        ev,
  72.                                       ODByteArray*        data )
  73. {
  74.     SOM_Trace("Cappuccino","CreateLink");
  75.  
  76.     ODLinkSource* linkSource = kODNULL;
  77.     
  78.     THROW(kODErrDoesNotLink);
  79.  
  80.     return linkSource;
  81. }
  82.  
  83. //------------------------------------------------------------------------------
  84. // Method:        LinkUpdated
  85. // Origin:        ODPart
  86. //
  87. // Description:    This method is called ...
  88. //------------------------------------------------------------------------------
  89.  
  90. void Cappuccino::LinkUpdated( Environment*        ev,
  91.                               ODLink*            link,
  92.                               ODUpdateID        updateID )
  93. {
  94.     SOM_Trace("Cappuccino","LinkUpdated");
  95.  
  96.     THROW(kODErrDoesNotLink);
  97. }
  98.  
  99. //------------------------------------------------------------------------------
  100. // Method:        RevealLink
  101. // Origin:        ODPart
  102. //
  103. // Description:    This method is called ...
  104. //------------------------------------------------------------------------------
  105.  
  106. void Cappuccino::RevealLink( Environment*        ev,
  107.                              ODLinkSource*        linkSource )
  108. {
  109.     SOM_Trace("Cappuccino","RevealLink");
  110.  
  111.     THROW(kODErrDoesNotLink);
  112. }
  113.  
  114. //------------------------------------------------------------------------------
  115. // Method:        LinkStatusChanged
  116. // Origin:        ODPart
  117. //
  118. // Description:    This method is called ...
  119. //------------------------------------------------------------------------------
  120.  
  121. void Cappuccino::LinkStatusChanged( Environment*        ev,
  122.                                     ODFrame*            frame )
  123. {
  124.     SOM_Trace("Cappuccino","LinkStatusChanged");
  125.  
  126.     // Since we currently don't link and don't have embedded content, we
  127.     // don't need to do anything for this call.  However, if we are embedded
  128.     // in a link, then this will be called to tell us when the link status
  129.     // of one of our frames changes.  We must implement this function because
  130.     // ODPart requires us to.
  131. }
  132.  
  133. //------------------------------------------------------------------------------
  134. // Method:        EmbeddedFrameUpdated
  135. // Origin:        ODPart
  136. //
  137. // Description:    This method is called ...
  138. //
  139. // Note:        This method only needs to be implemented for a part that
  140. //                supports embedding.
  141. //------------------------------------------------------------------------------
  142.  
  143. void Cappuccino::EmbeddedFrameUpdated( Environment*        ev,
  144.                                        ODFrame*            frame,
  145.                                        ODUpdateID        change )
  146. {
  147.     SOM_Trace("Cappuccino","EmbeddedFrameChanged");
  148.  
  149.     // The default behavior for this method is to do nothing.  The reason
  150.     // is that a part which does not support linking may be embedded within
  151.     // a part which publishes a link source, and then itself embed a part which
  152.     // calls ODFrame::ContentUpdated.  This part will be notified that the
  153.     // EmbeddedFrameUpdated, and the correct thing to do is nothing.  Only
  154.     // parts which want to do something special in response to this notification
  155.     // need to override this method.
  156. }
  157.  
  158. //------------------------------------------------------------------------------
  159. // Method:        EditInLinkAttempted
  160. // Origin:        ODPart
  161. //
  162. // Description:    This method is called ...
  163. //
  164. // Note:        This method only needs to be implemented for a part that
  165. //                supports embedding.
  166. //------------------------------------------------------------------------------
  167.  
  168. ODBoolean Cappuccino::EditInLinkAttempted( Environment*        ev,
  169.                                            ODFrame*            frame )
  170. {
  171.     SOM_Trace("Cappuccino","EditInLinkAttempted");
  172.  
  173.     THROW(kODErrCannotEmbed);
  174.  
  175.     return kODFalse;
  176. }
  177.  
  178.